gint width,
gint height);
static void gtk_default_draw_spinner (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
guint step,
static void
gtk_default_draw_spinner (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
guint step,
gint height)
{
GdkColor *color;
- cairo_t *cr;
guint num_steps;
gdouble dx, dy;
gdouble radius;
NULL);
real_step = step % num_steps;
- /* get cairo context */
- cr = gdk_cairo_create (window);
-
/* set a clip region for the expose event */
cairo_rectangle (cr, x, y, width, height);
cairo_clip (cr);
cairo_restore (cr);
}
-
- /* free memory */
- cairo_destroy (cr);
}
void
gint width,
gint height)
{
+ cairo_t *cr;
+
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_spinner != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
- GTK_STYLE_GET_CLASS (style)->draw_spinner (style, window, state_type,
- (GdkRectangle *)area, widget, detail,
+ cr = gtk_style_cairo_create (window, area);
+
+ gtk_cairo_paint_spinner (style, cr, state_type,
+ widget, detail,
+ step, x, y, width, height);
+
+ cairo_destroy (cr);
+}
+
+/**
+ * gtk_cairo_paint_spinner:
+ * @style: a #GtkStyle
+ * @cr: a #cairo_t
+ * @state_type: a state
+ * @widget: (allow-none): the widget (may be %NULL)
+ * @detail: (allow-none): a style detail (may be %NULL)
+ * @step: the nth step, a value between 0 and #GtkSpinner:num-steps
+ * @x: the x origin of the rectangle in which to draw the spinner
+ * @y: the y origin of the rectangle in which to draw the spinner
+ * @width: the width of the rectangle in which to draw the spinner
+ * @height: the height of the rectangle in which to draw the spinner
+ *
+ * Draws a spinner on @window using the given parameters.
+ */
+void
+gtk_cairo_paint_spinner (GtkStyle *style,
+ cairo_t *cr,
+ GtkStateType state_type,
+ GtkWidget *widget,
+ const gchar *detail,
+ guint step,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ g_return_if_fail (GTK_IS_STYLE (style));
+ g_return_if_fail (cr != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_spinner != NULL);
+
+ cairo_save (cr);
+
+ GTK_STYLE_GET_CLASS (style)->draw_spinner (style, cr, state_type,
+ widget, detail,
step, x, y, width, height);
+
+ cairo_restore (cr);
}
/**
gint width,
gint height);
void (*draw_spinner) (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
guint step,
gint y,
gint width,
gint height);
-void gtk_paint_spinner (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- const GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- guint step,
- gint x,
- gint y,
- gint width,
- gint height);
+void gtk_paint_spinner (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type,
+ const GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ guint step,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+void gtk_cairo_paint_spinner (GtkStyle *style,
+ cairo_t *cr,
+ GtkStateType state_type,
+ GtkWidget *widget,
+ const gchar *detail,
+ guint step,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+
GType gtk_border_get_type (void) G_GNUC_CONST;
GtkBorder *gtk_border_new (void) G_GNUC_MALLOC;